; [:::::::::::::::::::::::]
; [ The Space Bar 2.1     ]
; [ Logoff Segment        ]
; [:::::::::::::::::::::::]

term1
 print sc$
 If (Clock(2)=0) or (Clock(1)<Clock(2)) Goto ok.term
 print '
  ____________________________________________________________________________
 /                                                                            \
 |        I am sorry, but you have exceeded your time limit for this call.    |
 |                       Please Call Back Again Later                         |
 \____________________________________________________________________________/'\\

ok.term
 if info(2) fl$="D:Off.Msg":gosub Show.file
 x$=cn$:a=clock(1):x1$=str$((a/60)+1)+" minutes"
 print '
  
Hail Discovery!! -- Apple II Forever!

MS-DOS is CP/M on Steriods.. Bigger, Bulkier, and NOT much better!

You were caller number 'x$'
You were connected for 'x1$'

Call back soon!' 
 close:modem(1)

 Edit(0):Kill "G:Msg."+Str$(Un):kill "H:Batch"

 a=0:open #1,"b:top.download"
 for x=1 to 5:input #1,i$,a1,a2
 if (a3$=i$) and (d2=a2) x=5:next:close:goto nzw
 if (d1>a1) and not(a) print #8,a3$,d1,d2:a=1:goto tzp1
 if (d1=a1) and (d2>a2) and not(a) print #8,a3$,d1,d2:a=1

tzp1
 if a3$=i$ next:goto tzp2
 print #8,i$,a1,a2:next

tzp2
 close:
 if not(a) goto nzw
 kill "b:top.download":create "b:top.download"
 open #1,"b:top.download"
 copy #8,#1:close
 a=x

nzw 
 close:edit(0)
 a=0:open #1,"b:top.uploaders"
 for x=1 to 5:input #1,i$,a1,a2
 if (a3$=i$) and (u2=a2) x=5:next:close:goto nowrite
 if (u1>a1) and not(a) print #8,a3$,u1,u2:a=1:goto top1
 if (u1=a1) and (u2>a2) and not(a) print #8,a3$,u1,u2:a=1

top1
 if a3$=i$ next:goto top2
 print #8,i$,a1,a2:next

top2  
 close:
 if not(a) goto nowrite
 kill "b:top.uploaders":create "b:top.uploaders"
 open #1,"b:top.uploaders":copy #8,#1:close
 a=x

nowrite
 close:edit(0)
 a=0:open #1,"b:top.posters"
 for x=1 to 5:input #1,i$,a1,a2
 if (a3$=i$) and (hb=a2) x=5:next:close:goto nowrt2
 if (lb>a1) and not(a) print #8,a3$,lb,hb:a=1:goto tp1
 if (lb=a1) and (hb>a2) and not(a) print #8,a3$,lb,hb:a=1

tp1
 if a3$=i$ next:goto tp2
 print #8,i$,a1,a2:next

tp2
 close:
 if not(a) goto nowrt2
 kill "b:top.posters":create "b:top.posters"
 open #1,"b:top.posters":copy #8,#1:close
 a=x

nowrt2
 on nocar clear
 close:if a3$="" goto term4
 if not un goto term3

term2
 open #1,"b:users":byte(4)=byte(4)+1:tc=tc+1
 byte(5)=lr mod 256:byte(6)=lr/256
 byte(0)=info(3):when$="x"
 s8$=right$("00"+str$(val(left$(date$,2))),2)+"/"
 s8$=s8$+right$("00"+str$(val(mid$(date$,4,2))),2)+"/"
 s8$=s8$+right$("00"+str$(val(right$(date$,2))),2) 
 s9$=right$("00"+str$(val(left$(time$,2))),2)+":"
 s9$=s9$+right$("00"+str$(val(mid$(time$,4,2))),2)+":"
 s9$=s9$+right$("00"+str$(val(mid$(time$,7,2))),2)+" "+right$(time$,2)
 byte(7)=byte(7)+(clock(1)/60)
 if right$(cm$,2)<>"PM" goto termog
 if right$(time$,2)<>"AM" goto termog
 byte(7)=0:byte(4)=0:flag(36)=0

termog 
 byte(10)=hb mod 256:byte(11)=hb/256:byte(12)=lb mod 256:byte(13)=lb/256
 byte(3)=hm
 position #1,512,un:print #1,a3$,a4$,a5$
 position #1,512,un,71:write #1,ram,64
 position #1,512,un,150:print #1,s1$,s2$,s3$\s4$,s5$,s6$\s7$,s8$,s9$
 print #1,bp,tc,cl,pv\ul,dl,u1,u2,u3,d1,d2,d3\pt,do,ay:close:

term3
 ct=ct+1:c2=c2+1
 if c2>9999 then c2=0:c1=c1+1
 kill "b:data":create "b:data"
 open #1,"b:data"
 print #1,c1,c2,ct,ct$,date$,ab,du
 print #1,nu,tm,su,sd\a3$
 l5$=l4$:l4$=l3$:l3$=l2$:l2$=l1$:l1$=a3$
 l9$=l8$:l8$=l7$:l7$=l6$:l6$=l$:l$=time$
 print #1,l1$,l$\l2$,l6$\l3$,l7$\l4$,l8$\l5$,l9$:close
 edit(0)
 mc=bp-mg:uc=ul-ug:dc=dl-dg
 z$=left$(a3$+"..................",18)+"("+right$("00"+str$(un),3)+")"
 if not flag(1) z$=left$(a3$+chr$(46,18),18)+"-New-"
 Cz=Clock(1):Cy=Cz/60:Cz=Cz-(Cy*60):Cx=Cy/60:Cy=Cy-(Cx*60)
 a9$=right$("0"+str$(cx),1)+":"+right$("00"+str$(cy),2)+":"+right$("00"+str$(cz),2)
 ready "b:logs"
 if msg(0)=512 kill #msg(1):crunch:
 a=msg(0)+1
 c$=right$(cm$,11)
 print #msg(a),date$" "time$\nd,ct,cn$\z$\c$\a9$\mc\info(2)*300
 edit(0):copy #8,#6:update:ready " ":close
 open #1,"b:d.stats":input #1,v1,v2,v3,v4\w1,w2,w3,w4\v5,v6,v7,v8:close:
 v1=v1+1:v2=v2+mc:v3=v3+uc:v4=v4+dc
 if info(2)=4 v5=v5+1
 if info(2)=8 v6=v6+1
 if (info(2)=0) or (info(2)=32) v7=v7+1
 b=clock(1):b=b/60:w1=w1+b:a=val(left$(it$,2)):b=val(mid$(it$,4,2))
 w2=w2+b:if a w2=w2+(a*60)
 open #1,"h:stat":input #1,g,g1,g2:close
 w3=w3+g:w4=w4+g1:if g2 v8=v8+1
 kill "b:d.stats":create "b:d.stats"
 open #1,"b:d.stats":print #1,v1,v2,v3,v4\w1,w2,w3,w4\v5,v6,v7,v8:close

term4
 link "a:logon.seg"

show.file
 setint(1)
 copy fl$
 setint("")
 return
